package top.conangao.common.doc.autoconfig;

import io.swagger.v3.oas.models.ExternalDocumentation;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;

/**
 * @author ConanGao
 * @description
 * @since 2023/12/13 11:32
 **/
@AutoConfiguration
public class DocAutoConfig {

    @Bean
    @ConditionalOnMissingBean(OpenAPI.class)
    OpenAPI openApi() {
        return new OpenAPI()
                .info(new Info().title("API文档")
                                .description("API文档")
                                .version("1.0")
                                .contact(new Contact().name("conangao").url("https://gitee.com/conangaos/conangaocloud").email(
                                        "2872401708@qq.com"))
                                .license(new License().name("Apache 2.0").url("https://www.apache.org/licenses/LICENSE-2.0.html")))
                .externalDocs(new ExternalDocumentation().description("ConanGao").url(
                        "https://gitee.com/conangaos/conangaocloud"));

    }
}
